<template>
    <el-form-item :label="label">
        <el-cascader v-model="value" :options="options" v-bind="sonAttrs" clearable/>
    </el-form-item>
</template>
<script setup lang="ts">
import {computed,useAttrs} from 'vue'
type data = {
    value:string
    label:string
    children?:data[]
}
const attrs = useAttrs()
const value = defineModel()
const {options=[],label} = defineProps<{
    label:string
    options:data[]
}>()
const sonAttrs = computed(()=>{
    let attr = {...attrs}
    //默认不显示占位符
    if(!('placeholder' in attr))attr['placeholder'] = ' ';
    return attr
})
</script>
<style scoped>
.el-form-item>:deep(.el-form-item__content>.el-cascader){
    width:100%;
}
</style>